﻿<MudDialog>
    <TitleContent>
        <MudText Typo="Typo.h6">
            <MudIcon Icon="@Icons.Material.Filled.Logout" Class="mr-3 mb-n1"/>
            @ConstantString.LogoutConfirmationTitle
        </MudText>
    </TitleContent>
    <DialogContent>
        <MudText>@ContentText</MudText>
    </DialogContent>
    <DialogActions>
        <MudButton StartIcon="@Icons.Material.Filled.Cancel" OnClick="Cancel" title="@ConstantString.Cancel">@ConstantString.Cancel</MudButton>
        <MudButton StartIcon="@Icons.Material.Filled.Logout" Color="@Color" title="@ConstantString.Logout" OnClick="Submit">@ConstantString.Logout</MudButton>
    </DialogActions>
</MudDialog>


@code
{
    [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = default!;

    [Parameter] public string? ContentText { get; set; }

    [Parameter] public Color Color { get; set; }

    private Task Submit()
    {
        MudDialog.Close(DialogResult.Ok(true));
        Snackbar.Add(ConstantString.LogoutSuccess, Severity.Info);
        return Task.CompletedTask;
    }

    private void Cancel()
    {
        MudDialog.Cancel();
    }
}